﻿#nullable enable

using System;
using System.Collections.Generic;

namespace PHMEE.EnergyEfficiency;

/// <summary>
/// 航次能效信息 Dto
/// </summary>
public class VoyageEEInfoDto
{
    /// <summary>
    /// 航次号
    /// </summary>
    public string VoyageNumber { get; private set; }
    
    /// <summary>
    /// 航次的出发港 Code
    /// </summary>
    public string VoyageFrom { get; private set; }

    /// <summary>
    /// 航次的目的地港 Code
    /// </summary>
    public string VoyageTo { get; private set; }
    
    /// <summary>
    /// 开始时间（如果航次头部被查询的日期范围所截断，StartTime 就是第一个 log abstract 的 Ts）
    /// </summary>
    public DateTime StartTime { get; private set; }

    /// <summary>
    /// 结束时间（如果航次尾部被查询的日期范围所截断，EndTime 就是最后一个 log abstract 的 Ts）
    /// </summary>
    public DateTime EndTime { get; private set; }
    
    /// <summary>
    /// 结束时间与开始时间之间的小时数（精确到小数）
    /// </summary>
    public float HoursUnderway => (float)(EndTime - StartTime).TotalHours;
    
    /// <summary>
    /// 是否是 STS 航次
    /// </summary>
    public bool IsSTS { get; private set; } = false;
    
    /// <summary>
    /// 航程
    /// </summary>
    public float Distance { get; private set; }
    
    /// <summary>
    /// EEOI
    /// </summary>
    public float? EEOI { get; private set; }
    
    /// <summary>
    /// CII 和评级
    /// </summary>
    public CIIWithGradeDto CIIWithGrade { get; private set; }
    
    /// <summary>
    /// 油耗
    /// </summary>
    public List<FuelMeasurement> FuelConsumptions { get; private set; }

    public VoyageEEInfoDto(string voyageNumber, string voyageFrom, string voyageTo, DateTime startTime, DateTime endTime, bool isSTS, float distance, float? eeoi, CIIWithGradeDto ciiWithGrade, List<FuelMeasurement> fuelConsumptions)
    {
        VoyageNumber = voyageNumber;
        VoyageFrom = voyageFrom;
        VoyageTo = voyageTo;
        StartTime = startTime;
        EndTime = endTime;
        IsSTS = isSTS;
        Distance = distance;
        EEOI = eeoi;
        CIIWithGrade = ciiWithGrade;
        FuelConsumptions = fuelConsumptions;
    }
}